package cn.sc.summer.mybatis.enums;

import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 类名：批量更新方法枚举类
 *
 * @author a-xin
 * @date 2023/9/6 10:48
 */
@Getter
@AllArgsConstructor
public enum DataSourceEnum {

    MASTER("master", "主数据源Mysql【业务数据】"),
    SLAVE("slave", "从数据源Mysql【业务数据】"),
    POST_GRE_SQL("postgresql", "postgresql【日志采集】"),
    ;

    private final String type;
    private final String desc;

    public static DataSourceEnum getByType(String type) {
        if (StrUtil.isBlank(type)) {
            return null;
        }
        for (DataSourceEnum enums : DataSourceEnum.values()) {
            if (enums.type.equals(type)) {
                return enums;
            }
        }
        return null;
    }

}

